package student;

import java.util.HashSet;
import java.util.Set;

public class Test {
    public static void main(String[] args) {
        Set<Student> set = new HashSet<>();
        set.add(new Student(1, "Tom", 87));
        set.add(new Student(2, "Lucy", 95));
        set.add(new Student(3, "William", 65));
        set.add(new Student(3, "William", 78));
        System.out.println("集合中的元素有"+set.size()+"个");
        for (Student s:
             set) {
            System.out.println(s);
        }
    }
}
